package cn.com.dcsgo.controller;

import cn.com.dcsgo.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/*
参考前端项目文件：
前端请求路径及端口号：
dcsgo-uuyx-front-end/uuyx-admin/.env.development
api请求路径及其方式：
dcsgo-uuyx-front-end/uuyx-admin/src/api/user.js
响应内容：
dcsgo-uuyx-front-end/uuyx-admin/src/store/modules/user.js
*/

/**
 * IndexController
 *
 * @author Dcsgo
 * @since 2025/3/18 9:30
 */
@RestController
@Api(tags = "登录接口")
@RequestMapping("admin/acl/index")
public class IndexController {
    /**
     * 登录
     *
     * @return token
     */
    @ApiOperation("登录")
    @PostMapping("login")
    Result<Map<String, String>> login() {
        Map<String, String> map = new HashMap<>();
        map.put("token", "token-admin");
        return Result.ok(map);
    }

    /**
     * 获取用户信息
     *
     * @return name, avatar
     */
    @ApiOperation("获取用户信息")
    @GetMapping("info")
    Result<Map<String, String>> getInfo() {
        Map<String, String> map = new HashMap<>();
        map.put("name", "Dcsgo");
        map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    @ApiOperation("登出")
    @PostMapping("logout")
    Result<Serializable> logout() {
        return Result.ok(null);
    }
}
